const state = {
  defaultOrderNum:"",
  relateOrders:"",
  planTime:"",
  applyPerson:{},
  provideCompany:{},
  purchaseEditInfoCache:{
    id:"",
    orderState:"",
    defaultOrderNum:"",
    relateOrders:"",
    planTime:"",
    applyPerson:{},
    provideCompany:{}
  }
}

const mutations = {
  SET_DEFAULT_ORDER_NUM: (state, orderNumber) => {
    state.defaultOrderNum = orderNumber;
  },
  SET_RELATE_ORDERS:(state, relateOrders) => {
    state.relateOrders = relateOrders;
  },
  SET_PLAN_TIME:(state, planTime) => {
    state.planTime = planTime;
  },
  SET_APPLY_PERSON:(state, applyPerson) => {
    state.applyPerson = applyPerson;
  },
  SET_PROVIDE_COMPANY:(state, provideCompany) => {
    state.provideCompany = provideCompany;
  },
  CLEAR_DEFAULT_ORDER_NUM:(state) => {
    state.defaultOrderNum = "";
  },
  CLEAR_RELATE_ORDERS:(state) => {
    state.relateOrders = "";
  },
  CLEAR_PLAN_TIME:(state) => {
    state.planTime = "";
  },
  CLEAR_APPLY_PERSON:(state) => {
    state.applyPerson = {};
  },
  CLEAR_PROVIDE_COMPANY:(state) => {
    state.provideCompany = {};
  },
  CLEAR_STATE:(state) => {
    state.defaultOrderNum = "";
    state.relateOrders = "";
    state.planTime = "";
    state.applyPerson = {};
    state.provideCompany = {};
  },
  SET_CACHE_DEFAULT_ORDER_NUM:(state,defaultOrderNum) => {
    state.purchaseEditInfoCache.defaultOrderNum = defaultOrderNum;
  },
  SET_CACHE_RELATE_ORDERS:(state,relateOrders) => {
    state.purchaseEditInfoCache.relateOrders = relateOrders;
  },
  SET_CACHE_PLAN_TIME:(state,planTime) => {
    state.purchaseEditInfoCache.planTime = planTime;
  },
  SET_CACHE_APPLY_PERSON:(state,applyPerson) => {
    state.purchaseEditInfoCache.applyPerson = applyPerson;
  },
  SET_CACHE_PROVIDE_COMPANY:(state,provideCompany) => {
    state.purchaseEditInfoCache.provideCompany = provideCompany;
  },
  SET_CACHE_ID:(state, id) => {
    state.purchaseEditInfoCache.id = id;
  },
  SET_CACHE_STATE:(state, orderState) => {
    state.purchaseEditInfoCache.orderState = orderState;
  },
  CLEAR_PURCHASE_EDIT_INFO_CACHE:(state) => {
    state.purchaseEditInfoCache = {
      id:"",
      orderState:"",
      defaultOrderNum:"",
      relateOrders:"",
      planTime:"",
      applyPerson:{},
      provideCompany:{}
    }
  }
}

const actions = {
  //
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
